
#ifndef _GM_HELPER_H_
#define _GM_HELPER_H_

#include "../gm_api/skfapi.h"

#ifndef _WIN32

#define _stdcall
#endif

#ifdef __cplusplus
extern "C" {
#endif

	int _stdcall MKF_X509Der2RSAPRIVATEKEYBLOB(unsigned char * pData, int ulDataLen, RSAPRIVATEKEYBLOB * pRsaPriBlob);
	int _stdcall parse_key_to_RSAPRIVATEKEYBLOB(unsigned char * pData, int ulDataLen, RSAPRIVATEKEYBLOB * pRsaPriBlob);

	int parse_cert_attributes(unsigned char * pCertData, long cert_len);

	void parse_cert_attributes_free();

	unsigned char * parse_cert_get_serial_num(int * serial_len);

	unsigned char * parse_cert_get_subject(int * subject_len);

	unsigned char * parse_cert_get_label(int * label_len);

	unsigned char * parse_cert_get_CN(int * CN_len);

	unsigned char * parse_cert_get_issuer(int * issuer_len);

	unsigned char * parse_issuer_name(int * name_len);

	int parse_cert_get_start_date(unsigned char year[4],unsigned  char month[2],unsigned  char day[2]);

	int parse_cert_get_end_date(unsigned char year[4],unsigned  char month[2],unsigned  char day[2]);

	int get_public_key_from_cert(int ulCertType, unsigned char *pcbCert, int dwCertLen,
								   unsigned char *pstPubKeyBlob, int *ulPubkeylen);

#ifdef __cplusplus
}
#endif


#endif
